import request from "@/utils/request";

export function getRoleList(params) {
  return request({
    url: "/sys/role",
    params,
    method: "get",
  });
}

export function addRoleApi(data) {
  return request({
    data,
    url: "/sys/role",
    method: "post",
  });
}

export function editRoleApi(data) {
  return request({
    url: `/sys/role/${data.id}`,
    method: "put",
    data,
  });
}

export function delRoleApi(id) {
  return request({
    url: `/sys/role/${id}`,
    method: "DELETE",
  });
}

// 分配权限
export function assignPermissionApi(data) {
  return request({
    url: "/sys/role/assignPrem",
    method: "put",
    data,
  });
}

// 获取角色详情
export function getRoleDDetail(id) {
  return request({
    url: `/sys/role/${id}`,
  });
}
